Repository navigation
fix(plugin-grid): leave a raw aggregate over a record-mode quantity out of the whole-set footer and group headers - #36271
Conversation
…ut of the whole-set footer and group headers The rule that left a sum / avg / min / max over a record-mode amount out of the whole-set footer query, the footer cell and the group-header aggregations now reads a record-mode quantity too (unitConfig.unitMode 'record', grouped only by its unitField), the way the engine's aggregate door refuses it. Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…e-out Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 Final green head · area a4-D · 2026-11-22T04:36Z |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd 席位核对 — ACCEPT · head 9f56bc1
|
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 席位核对Landing · area a4-D · 2026-11-22T04:38Z · head
Ready + auto-merge now. |
Requested by Leehom · project thread
Fixes #36082
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
One rule in
recordCurrencyAggregates.ts, two readers: a rawsum/avg/min/maxover a measure whose unit each record names itself needs the rows grouped by that unit's field.recordUnitField(def)reads arecord-mode quantity exactly as the engine doorrecordUnitFieldOfdoes (packages/objectql/src/record-unit-aggregate-door.ts): anumberwithunitConfig.unitMode === 'record'and a non-emptyunitField.recordMeasureUnitField(def)= the currency code field (recordCurrencyFieldfrom@object-ui/i18n, unchanged) or that unit field.requiredCurrencyGroupingbecomesrequiredAggregateGroupingandisMoneyAggregatebecomesisMeasureAggregate(module-internal, not in the package barrel); the aggregate set stays one constant.wholeSetSummaryNodes(the whole-set footer query leaves the node out),honestGroupAggregations(a group aggregate stands only when grouped by the unit field),useScopedColumnSummary(the footer cell draws nothing for it, as for a record-mode amount) andofferedColumnSummaries(the footer menu offers the count family only).packages/specchange. No new per-unit total.Tests
recordCurrencyAggregates-27188.test.tsx, new top-level describe for the quantity: footer draws no sum / avg / min / max and the count stands; fixed-mode and plain-number controls sum; the menu offers no aggregate; group aggregates stand grouped byunit_codeand drop otherwise; the predicate's edges (emptyunitField, non-numbertype).footerSummaryScope-12081.test.tsx, new top-level describe (the double now refuses a record-mode quantity aggregate as the engine does): a view with a record-mode quantitysumbeside a plain-numbersumsends one query carrying onlycountandsum_amount, the plain column shows its whole-set figure, the quantity column shows nothing, zero refusals. Control: afixed-mode quantity is asked and totals over the whole set.scripts/ablation-replace.mjs, mutation landed and restore proven by blob hash): see Verification.Acceptance notes
honestGroupAggregationskeeps a measure aggregate when the unit or code field is at ANY grouping level, anduseServerGroupingasks each depth with the firstdepthgrouping fields. Measured with the spec'scompileListViewGroupQuery: groupingregionthenunit_codewith asumoverqtycompiles depth 1 togroupBy: ["region"]carryingsum_qty, which the engine's unit door (and the currency door, for a record-mode amount) refuses. This PR keeps the currency precedent's rule unchanged and applies it to quantities, as the card ordered.Verification
Read first:
ui/packages/plugin-grid/src/recordCurrencyAggregates.ts:recordUnitFieldmust match the engine door's reading.ui/packages/plugin-grid/src/useWholeSetSummary.ts: the leave-out line inwholeSetSummaryNodes.ui/packages/plugin-grid/src/useColumnSummary.ts: the footer skip andofferedColumnSummaries.Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/recordCurrencyAggregates-27188.test.tsx packages/plugin-grid/src/__tests__/footerSummaryScope-12081.test.tsxfrom the repo root; expect 42 passed.Readings (source tree at 9f56bc1; the test runs were taken at ae56a75, whose sources are byte-identical, the later commit adds only the changeset):
Pin files and the plugin-grid suite
vitest runof the two pin files: Test Files 2 passed (2), Tests 42 passed (42).vitest run packages/plugin-grid/: Test Files 300 passed (300), Tests 2657 passed (2657); lock VERDICT command-exit 0.pnpm --filter @object-ui/plugin-grid type-check(tsc on src and ontsconfig.test.json, which lists both pin files): VERDICT command-exit 0.Ablations, one per leg
Each mutation through
scripts/ablation-replace.mjs(anchor 1 to 0, blob changed), restored with blob equal to HEAD and an emptygit diff HEAD. The subject resolves tosrc(relative imports), so no rebuild sits between mutation and run.?? recordUnitField(def)removed): 5 failed / 37 passed, exactly the five quantity pins; every currency pin and control stays green. A first attempt was refused by the tool (the replacement was a bare semicolon, whose count could not rise); it ran nothing and is not counted.continueinwholeSetSummaryNodesremoved): 5 failed / 25 passed, the four record-currency pins and the quantity whole-set pin.offeredColumnSummaries) disabled: 1 failed / 11 passed, the quantity menu pin.honestGroupAggregationskeeps all): 2 failed / 10 passed, the currency and the quantity drop pins.Local gate subset
Derived by
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack(38 commands); all 38 exit 0.pnpm --dir ui exec vitest run scripts/queue-timed out twice on the shared verify lock (exit 99), then passed on the third attempt after the PR was opened: 172 files passed, 2 skipped; 5122 tests passed.pnpm check:type-check-debtfirst queue-timed out, then exit 0 on retry. Outside the list:check-platform-checklist --changed-from origin/mainexit 0 (no anchored file),pnpm --dir ui check:new-line-citations0 new.overlap-checkVERDICT clean.